import 'package:flutter/material.dart';
import 'package:navigator_demo/navigator2pointzero/router/app_router_delegate.dart';

class CommonPage extends StatelessWidget {
  final String title;
  CommonPage({
    this.title,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('title $title'),
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios),
          onPressed: () {
            AppRouterDelegate.of(context).pop();
          },
        ),
      ),
      body: ListView(
        children: [
          ListTile(
            title: Text('item $title'),
            onTap: () {
              AppRouterDelegate.of(context).push('$title + 1');
            },
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(onPressed: () {
        AppRouterDelegate.of(context).pop();
      }),
    );
  }
}
